package com.app.GoCuro;

import com.app.GoCuro.util.DatabaseInformation;
import com.app.GoCuro.util.LoginResponse;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class TabLayoutActivity extends TabActivity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		final DatabaseInformation databaseInfo = (DatabaseInformation) getIntent()
				.getSerializableExtra("selected_database");
		final LoginResponse loginResponse = (LoginResponse) getIntent()
				.getSerializableExtra("curr_user");

		TabHost tabHost = getTabHost();

		// Tab for Add new Item
		TabSpec addItemSpec = tabHost.newTabSpec("Add Item");
		// setting Title and Icon for the Tab
		addItemSpec.setIndicator("Add Item",
				getResources().getDrawable(R.drawable.icon_additemtab));
		Intent addNewIntent = new Intent(this, DatabaseActionsActivity.class);
		addNewIntent.putExtra("selected_database", databaseInfo.getName());
		addItemSpec.setContent(addNewIntent);

		// Tab for view Items
		TabSpec viewItemsSpec = tabHost.newTabSpec("View Items");
		viewItemsSpec.setIndicator("View Items",
				getResources().getDrawable(R.drawable.icon_viewitemtab));
		Intent viewItemsIntent = new Intent(this, ViewItemsActivity.class);
		viewItemsIntent.putExtra("selected_database", databaseInfo);
		viewItemsIntent.putExtra("curr_user", loginResponse);
		viewItemsSpec.setContent(viewItemsIntent);
		
		//Tab for settings
		
		//Tab for about

		// Adding all TabSpec to TabHost
		tabHost.addTab(addItemSpec); // Adding photos tab
		tabHost.addTab(viewItemsSpec); // Adding songs tab

	}
}
